#!/bin/sh

function prepare()
{
	echo "Preparing $1..."
	DIR="$1_zipdir"
	if [ -z $DIR ]
	then
		mkdir $DIR
	else
		rm -r $DIR
		mkdir $DIR
	fi
}

function dounzip()
{
	echo "Unzipping $1..."
	cd $1_zipdir
	unzip ../$1.zip
	cd ..
}

function dodiff()
{
	echo "Comparing $1 and $2..."
	DIFF="$1_$2_diff.diff"
	DIFFTOOL="kompare"
	diff -ru "$1_zipdir" "$2_zipdir" > $DIFF
	$DIFFTOOL $DIFF
}

prepare "bachelorthesis"
prepare "bachelorthesis_fix"

dounzip "bachelorthesis"
dounzip "bachelorthesis_fix"

dodiff "bachelorthesis" "bachelorthesis_fix"

